<template>
  <div class="login">
    <form id="formBox" autocomplete="on">
        <div name="user" class="input-wrap">
            <label for="userName">用户名:</label>
            <input type="text" id="userName" v-model="loginInfo.userName" />
        </div>
        <div name="password" class="input-wrap">
            <label for="password">密码:</label>
            <input id="password" v-model="loginInfo.password" type="password" />
        </div>
        <button type="button" @click="login" autocomplete  style="margin-right:20px">登录</button>
        <button type="button" @click="jumpReg" autocomplete >去注册</button>
      </form>
    </div>
</template>

<script setup>
import userLogin from "../hooks/useLogin";
import {router} from '@/router/router';
const {loginInfo,justifyEmpty,submit} = userLogin();

function login(){
  let isValid = justifyEmpty(loginInfo);
  if(isValid){
    submit(loginInfo)
  }
}
function jumpReg(){
  router.replace({
    path:"/reg"
  })
}

</script>

<style lang="less" scoped>
    
</style>
